<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/static/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/static/代码CSS/Home_css.css">
    <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/static/jquery-ui-1.12.1/external/jquery/jquery.js">
    <script src="/static/bootstrap/js/bootstrap.js"></script>
    <script src="/static/jquery-ui-1.12.1/external/jquery/jquery.js"></script>
    {% load static %}
    <link REL="SHORTCUT ICON" HREF="{% static "Image/favicon.ico" %}"/>
</head>
<body>
<!--头部标题-->
<div class="body_meau">
    <div class="header_meau">
        <div class="header_meau_logo left">
            <div class="header_meau_logo_image">
                <i class="fa fa-cart-arrow-down fa-3x" aria-hidden="true"></i>
            </div>
            <div class="header_meau_logo_right">
                <b><a class="header_meau_logo_right_font" href="{% url 'person_info' %}">用户中心</a></b>
                <b><a class="header_meau_logo_right_font" href="{% url 'usercart' %}">我的订单</a></b>
                <b><a class="header_meau_logo_right_font">客户服务</a></b>
                <b><a class="header_meau_logo_right_font" HREF="Home.html">网站导航</a></b>
            </div>
        </div>
        <div class="header_meau_Landing_search">
            <input type="text" style="width: 371px; height: 29px; position: relative; top: 8px;left: 79px;"/>

            <div style=" position: relative;width: 50px;height:44px;float: right; top: 7px;">
                <!--<i class="fa fa-search fa-2x" aria-hidden="true" ></i>-->
                <button style=" position: relative;width: 50px;height:37px;left: 64px;top: 2px; cursor: pointer;">
                    <i class="fa fa-search fa-1x" aria-hidden="true"></i>
                </button>
            </div>

        </div>
        <div class="header_meau_Landing right">
            <div class="header_meau_Landing icon">
                <i class="fa fa-id-card-o fa-2x" aria-hidden="true"></i>
            </div>

            <div class="body_usinfo">
                <!--
                    作者：1045077189@qq.com
                    时间：2020-03-03
                描述：插入登录信息
                -->
                {% if username %}
                    <i class="fa fa-id-badge" aria-hidden="true"></i>
                    <a style="position: absolute;top: 17px;font-size: 15px;left: 0;"><span>{{ username }}</span></a>

                {% else %}
                    <a style="position: absolute;top: 17px;font-size: 15px;left: 0;"><span>用户未登录</span>
                        <i class="fa fa-id-badge" aria-hidden="true"></i></a>
                {% endif %}
                <a href="/quite/">退出登录</a>
            </div>

            <div class="header_meau_Landing landing1">
                <a href="{% url 'login' %}">
                    <button style="position: relative;top: 9px; font-size: 14px;" class="btn btn-success" type="submit">
                        登录
                    </button>
                </a>
                &nbsp; &nbsp;
                <a href="{% url 'regiter' %}">
                    <button style="position: relative;top: 9px; font-size: 14px;" class="btn btn-group" type="submit">
                        注册
                    </button>
                </a>
            </div>
            <div class="header_meau_Landing send">
                <a style="position: absolute;top: 6px; font-size: 19px;padding: 0px 15px 0px 15px; left: 25px;">意见箱</a>
            </div>
        </div>
        <div class="header_meau_Landing set ">
            <i class="fa fa-cogs fa-spin" aria-hidden="true" style="padding-top: 15px;"></i>
        </div>
    </div>
</div>
<!--左侧导航栏-->

<!--右侧商品展示栏-->
<div class="body_down" id="l1">

    <div class="left_meau">

        <div class="left_meau meau1">
            <a href="#"><input type="button" class="left_meau meau1 button1" value="手机"/></a>

        </div>
        <div class="left_meau meau2">
            <a href="https://www.baidu.com"><input type="submit" class="left_meau meau1 button2" value="电脑"/></a>
        </div>
        <div class="left_meau meau3">
            <a><input type="submit" class="left_meau meau1 button3" value="电子手表"/></a>
        </div>
        <div class="left_meau meau4">
            <a><input type="submit" class="left_meau meau1 button4" value="音影娱乐"/></a>
        </div>
        <div class="left_meau meau5">
            <input type="submit" class="left_meau meau1 button5" value="数码配件"/>
        </div>
        <div class="left_meau meau6">
            <input type="submit" class="left_meau meau1 button6" value="摄影摄像"/>
        </div>
        <div class="left_meau meau7">
            <input type="submit" class="left_meau meau1 button7" value="平板"/>
        </div>
        <div class="left_meau meau8">
            <input type="submit" class="left_meau meau1 button8" value="智能设备"/>
        </div>
        <div class="left_meau meau9">
            <input type="submit" class="left_meau meau1 button9" value="手机配件"/>
        </div>
        <div class="left_meau meau10">
            <input type="submit" class="left_meau meau1 button10" value="宿舍神器"/>
        </div>
        <div class="left_meau meau11">
            <input type="submit" class="left_meau meau1 button11" value="影视设备"/>
        </div>
        <div class="left_meau meau12">
            <input type="submit" class="left_meau meau1 button12" value="学习用品"/>
        </div>
        <i class="fa fa-shopping-basket" aria-hidden="true" style="position: absolute;top:5px ;left: 40px;"></i>
        <i class="fa fa-refresh fa-2x fa-spin" aria-hidden="true" style="position: absolute;top:512px ;left: 40px;"></i>
        <!--商品展示区域-->
    </div>
    <div class="title_body teansverse_line"></div>
    <div style="display: inline-block">
        {% for goods in obj %}
            <div class="show_shopping">
                <img alt="100x200" src="{{ MEDIA_URL }}{{ goods.img }}" class="Image">
                <div class="show_shopping_name">
                    <a class="show_shopping_reading">{{ goods.goods_name }}:</a>
                    <a style="color: red">{{ goods.goods_price }}</a>
                </div>

                <div class="show_shopping_info">

                        <a class="show_shopping_reading">{{ goods.goods_info }}</a>
                        <button class="show_shopping_info_add" goodsid="{{ goods.id }}" >增加</button>
                            <span class="show_shopping_info_count">0</span>
                        <button class="show_shopping_info_sub">减少</button>

                </div>

                <div class="show_shopping_btn">
                    <button class="btn btn-primary" type="submit"
                            style="width: 90px;top: 13px;position: absolute;left: 7px;">购买
                    </button>

                    <button class="btn btn-danger" type="submit"
                            style="width:90px;top: 13px;position: absolute;right: 7px;"
                            name="addshopping">加入购车
                    </button>


                </div>

            </div>
        {% endfor %}
    </div>
</div>


<!--底部信息栏-->
<!--div class="show_menu_content">
    <div class="show_menu_content content1">
        <a style="padding: 0 20px; ">联系我们 </a>
        <a>|</a>
        <a style="padding: 0 20px;">关于我们</a>
        <a>|</a>
        <a style="padding: 0 20px;">联系我们 </a>
        <a>|</a>
        <a style="padding: 0 20px;">商家入驻</a>
        <a>|</a>
        <a style="padding: 0 20px;">友情链接</a>
        <a>|</a>
        <a style="padding: 0 20px;">校园社区</a>
        <a>|</a>
        <a style="padding: 0 20px;">销售联盟</a>
        <a>|</a>
        <a style="padding: 0 20px;">校区管理</a>
        <a>|</a>
        <a style="padding: 0 20px;">English Site</a>
    </div>
</div>
</div-->
<script>

    $(".show_shopping_info_add").click(function () {
        window.alert("添加成功");
        console.log('add');
        var $add = $(this);
        var goodsid = $add.attr('goodsid');
        $.get('/addcart/', {'goodsid': goodsid}, function (data) {
            console.log(data);
            if (data['status'] === 302) {
                window.location.href = "/Login2/";
            } else if (data['status'] === 200) {
                $add.prev('span').html(data['c_goods_num']);
            }
        })
    })
    $(".show_shopping_info_sub").click(function () {
        console.log('sub')

    })
    {#var addshoppings = document.getElementsByName(addshopping);#}
    {#for (var i; i<addshopping.length;i++){#}
    {#    addshopping = addshoppings[i];#}
    {#    addshopping.addEventListener("click", function () {#}
    {#    gid = this.getAttribute("goodid");#}
    {#    $.post("/changecart/0/", {"goodid": gid},function (data) {#}
    {#        if (data.status =="success"){#}
    {##}
    {#        }#}
    {#    });#}
    {#    alert("asdasdasd");#}


</script>

</body>

</html>